import request from '@/utils/request'

// 查询爬虫任务列表
export function listTask(query) {
  return request({
    url: '/system/crawler/task/list',
    method: 'get',
    params: query
  })
}

// 查询爬虫任务详细
export function getTask(id) {
  return request({
    url: '/system/crawler/task/' + id,
    method: 'get'
  })
}

// 执行爬虫任务
export function executeTask(data) {
  return request({
    url: '/system/crawler/task/execute',
    method: 'post',
    data: data
  })
}

// 停止爬虫任务
export function stopTask(id) {
  return request({
    url: '/system/crawler/task/stop/' + id,
    method: 'post'
  })
}

// 删除爬虫任务
export function delTask(id) {
  return request({
    url: '/system/crawler/task/' + id,
    method: 'delete'
  })
}

// 批量删除爬虫任务
export function delTaskBatch(ids) {
  return request({
    url: '/system/crawler/task/batch/' + ids.join(','),
    method: 'delete'
  })
}

// 获取任务状态
export function getTaskStatus(id) {
  return request({
    url: '/system/crawler/task/status/' + id,
    method: 'get'
  })
} 